//*************************************************************************************************
//************************ (C) 2001 - 2006, Eleven Engineering Incorporated ***********************
//*************************************************************************************************
//**
//**		Tabs:	This file looks best with tab stops set every 6 spaces.
//**
//*************************************************************************************************
//*************************************************************************************************
//**
//**          File:  XPD MiniEcho.asm
//**       Project:  XInC Library
//**       Created:  04 Jan 2003 by Ryan Northcott
//**       Revised:  08 Sep 2006 by Dan Beutel
//**
//**   Description:  A simple routine for echoing ASCII characters to the terminal
//**                 with little overhead.
//**
//** Compatibility:  Requires XInA v4.4 or higher.
//**
//**    Disclaimer:  You may incorporate this sample source code into your program(s) without
//**                 restriction.  This sample source code has been provided "AS IS" and the
//**                 responsibility for its operation is yours.  You are not permitted to
//**                 redistribute this sample source code as "Eleven sample source code" after
//**                 having made changes.  If you are going to re-distribute the source, we require
//**                 that you make it clear in the source that the code was descended from Eleven
//**                 sample source code, but that you have made changes.
//**
//*************************************************************************************************
//*************************************************************************************************
//**
//**	XPD_MiniEcho
//**
//*************************************************************************************************
//*************************************************************************************************


#ifndef __XPD_MINIECHO__
#define __XPD_MINIECHO__

//=============================================================================
// Input Params:	r1 = ASCII Charater to echo
// Output Params:	r0 = Garbage
//			r4 = Garbage
//			r5 = Garbage
//			r6 = Garbage
//-----------------------------------------------------------------------------
// Description:	Echos an ASCII character to the terminal.
//=============================================================================

XPD_MiniEcho:
		mov	r4, 0x4000
		jsr	r5, XPD_MiniEcho_RW
		bis	r4, r1, 15
		jsr	r5, XPD_MiniEcho_RW
		jsr	r6, r6
		
	XPD_MiniEcho_RW:
		inp	r0, GPBin
		bic	r0, r0, 1
		bic	r0, r0, 2
		outp	r0, GPBout
		rol	r0, r4, 8
		outp	r0, SPI0tx
		inp	r0, SPI0rx
		outp	r4, SPI0tx
		rol	r4, r0, 8
		inp	r0, SPI0rx
		ior	r4, r4, r0
		inp	r0, GPBin
		bis	r0, r0, 1
		bis	r0, r0, 2
		outp	r0, GPBout
		jsr	r5, r5
		
#endif